package org.example.springcloud.controller;

import org.example.springcloud.service.StorageService;
import org.example.springcloud.utils.ResultVOUtil;
import org.example.springcloud.vo.ResultVO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author: y
 * @CreateDate: 8/2/21 9:41 AM
 * @Version: 1.0
 */
@RestController
public class StorageController {

    private final StorageService storageService;

    public StorageController(StorageService storageService) {
        this.storageService = storageService;
    }

    //扣减库存
    @RequestMapping("/storage/decrease")
    public ResultVO decrease(Long productId, Integer count) {
        storageService.decrease(productId, count);
        return ResultVOUtil.success(200, "扣减库存成功！");
    }
}



